home *** CD-ROM | disk | FTP | other *** search
- /*******************************************************************************
-
- BusErrTest by Cameron
-
- *******************************************************************************/
-
- #include <String.h>
-
- /* Type 1 includes */
- #include <Types.h>
- #include <QuickDraw.h>
-
- /* Type 2 includes */
- #include <Controls.h>
- #include <Events.h>
- #include <Fonts.h>
- #include <Memory.h>
- #include <Menus.h>
- #include <OSUtils.h>
- #include <Resources.h>
- #include <SegLoad.h>
- #include <TextEdit.h>
- #include <ToolUtils.h>
- #include <Traps.h>
-
- /* Type 3 includes */
- #include <Desk.h>
- #include <Files.h>
- #include <OSEvents.h>
- #include <Windows.h>
-
- /* Type 4 includes */
- #include <Dialogs.h>
-
- /* Global Variables */
-
- Str255 WindTitle;
- WindowPtr MyWindow,aWindPtr;
- short err,itemHit;
- EventRecord MyEvent;
- Boolean quit,DrawOn,IsBtn;
- Rect WindRect,Rect1,Rect2;
- Point aPoint;
- CursHandle myCrsr;
-
- /*************************************************************************************/
- extern void INSTALLVECTOR();
- extern void CAUSEBUSERR();
- extern void REPLACEVECTOR();
-
- /*************************************************************************************/
- void InitMac()
- {
- InitGraf(&qd.thePort);
- InitFonts();
- FlushEvents(everyEvent,0);
- InitWindows();
- InitCursor();
- quit = false;
- DrawOn = false;
- IsBtn = false;
- }
- /*************************************************************************************/
- void DoDraw()
- {
- DrawOn = true;
- GlobalToLocal(&MyEvent.where);
- MoveTo(MyEvent.where.h,MyEvent.where.v);
- EraseRect(&WindRect);
- }
- /*************************************************************************************/
- main()
- {
- InitMac();
-
- MyWindow = GetNewWindow(2009,nil,(WindowPtr)-1);
-
- if (MyWindow)
- {
- SetPort(MyWindow);
- INSTALLVECTOR();
- while (quit != true)
- {
- if (DrawOn)
- {
- if (StillDown())
- {
- GetMouse (&aPoint);
- StdLine (aPoint);
- }
- else { DrawOn = false; }
- }
- else
- {
- if (WaitNextEvent(everyEvent,&MyEvent,0,nil))
- {
- switch (MyEvent.what)
- {
- case mouseDown:
- {
- if ((FindWindow (MyEvent.where,&aWindPtr) == inContent) /* make sure the mouseDown is */
- && (aWindPtr == MyWindow)) /* where we want it */
- { CAUSEBUSERR(); }
- else if (FindWindow (MyEvent.where,&aWindPtr) == inGoAway)
- { quit = true; }
- break;
- }
- case keyDown:
- {
- if ((char)(BitAnd (MyEvent.message,charCodeMask)) == 'q')
- { quit = true; }
- break;
- }
- }
- }
- }
- }
- REPLACEVECTOR();
- }
- }